<extend name="Public/layout"/>

<block name="style">
    <style type="text/css">
        body {
            background-color: #f6f6f6;
        }
    </style>
</block>

<block name="wrap">
    <div class="container">
        <div class="dashboard margin-top">
            <div class="row">
                <div class="col-xs-12 col-sm-6 col-md-4 ">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <div class="panel-actions"></div>
                            <i class="glyphicon glyphicon-home"></i> 系统概览
                        </div>
                        <div class="panel-body">
                            <table class="table table-condensed">
                                <tbody>
                                    <tr>
                                        <td>今日增加订单数</td>
                                        <td>
                                            <a class="btn btn-warning btn-xs" href="{:U('Manage/Order/index')}">{$today_order_count|default='0'}</a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>今日增加会员数</td>
                                        <td>
                                            <a class="btn btn-warning btn-xs" href="{:U('Manage/Member/index')}">{$today_member_count|default='0'}</a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>总订单数</td>
                                        <td>
                                            <a class="btn btn-primary btn-xs" href="{:U('Manage/Order/index')}">{$all_order_count|default='0'}</a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>总会员数</td>
                                        <td>
                                            <a class="btn btn-primary btn-xs" href="{:U('Manage/Member/index')}">{$all_member_count|default='0'}</a>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-6 col-md-4">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <div class="panel-actions"></div>
                            <i class="glyphicon glyphicon-cog"></i> 系统信息
                        </div>
                        <div class="panel-body">
                            <table class="table table-condensed">
                                <tbody>
                                    <tr>
                                        <td>服务器操作系统</td>
                                        <td>{$Think.const.PHP_OS}</td>
                                    </tr>
                                    <tr>
                                        <td>运行环境</td>
                                        <td>{$_SERVER['SERVER_SOFTWARE']}</td>
                                    </tr>
                                    <tr>
                                        <td>MYSQL版本</td>
                                        <td><php>$system_info_mysql = M()->query("select version() as v;");</php>{$system_info_mysql.0.v}</td>
                                </tr>
                                <tr>
                                    <td>上传限制</td>
                                    <td>{:ini_get('upload_max_filesize')}</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-6 col-md-4">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <div class="panel-actions"></div>
                            <i class="glyphicon glyphicon-th-list"></i> 产品团队
                        </div>
                        <div class="panel-body">
                            <table class="table table-condensed">
                                <tbody>
                                    <tr>
                                        <td>总策划</td>
                                        <td>郑州仟米软件科技有限公司</td>
                                    </tr>
                                    <tr>
                                        <td>研发团队</td>
                                        <td>研发部</td>
                                    </tr>
                                    <tr>
                                        <td>官方网址</td>
                                        <td><a target="blank" href="http://www.kmeen.com">http://www.kmeen.com</a></td>
                                    </tr>
                                    <tr>
                                        <td>联系我们</td>
                                        <td>350687161@qq.com</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-6 col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <div class="pull-right">
                                <button id="daterange_set" class="btn btn-default btn-sm" style="margin-top:-5px;margin-right:-5px;"><span class="glyphicon glyphicon-cog"></span></button>
                            </div>
                            <i class="glyphicon glyphicon-stats"></i> 用户增长统计
                        </div>
                        <div class="panel-body">
                            <h5 class="text-center">{$start_date}－{$end_date} {$count_day}天用户增长</h5>
                            <canvas id="mychart" style="width:100%;height:300px;"></canvas>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function(){
        //用户增长曲线图
        var mychart = new Chart($("#mychart").get(0).getContext("2d")).Line(
        {
        labels : {$user_reg_date},
                datasets : [
                {
                fillColor : "#337ab7",
                        strokeColor : "#337ab7",
                        pointColor : "#337ab7",
                        pointStrokeColor : "#fff",
                        data : {$user_reg_count}
                }
                ]
        },
        {
        scaleLineColor : "rgba(0,0,0,.1)", //X/Y轴的颜色
                scaleLineWidth : 1 //X/Y轴的宽度
        }
        );
                //图表时间段选择
                $('#daterange_set').daterangepicker({
        startDate: moment().subtract(29, 'days'),
                endDate: moment(),
                minDate: '01/01/2015',
                maxDate: '12/31/2100',
                dateLimit: { days: 360 },
                showDropdowns: true,
                showWeekNumbers: true,
                timePicker: false,
                timePickerIncrement: 1,
                timePicker12Hour: true,
                ranges: {
                '最近7天': [moment().subtract(6, 'days'), moment()],
                        '这个月': [moment().startOf('month'), moment().endOf('month')],
                        '上个月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
                },
                opens: 'left',
                buttonClasses: ['btn btn-default'],
                applyClass: 'btn-sm btn-primary',
                cancelClass: 'btn-sm',
                format: 'MM/DD/YYYY',
                separator: ' to ',
                locale: {
                applyLabel: '确定',
                        cancelLabel: '清除',
                        fromLabel: '从',
                        toLabel: '到',
                        customRangeLabel: '自定义',
                        daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                        monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                        firstDay: 1
                }
        },
                function(start, end, label){
                var url = '{:U("Index/index")}';
                        var query = 'start_date=' + start + '&end_date=' + end;
                        if (url.indexOf('?') > 0){
                url += '&' + query;
                } else{
                url += '?' + query;
                }
                window.location.href = url;
                }
        );
        });
    </script>
</block>
